package com.gxa.ssm340.service.impl;

import com.gxa.ssm340.common.PageDTO;
import com.gxa.ssm340.entity.pojo.Reward;
import com.gxa.ssm340.mapper.RewardMapper;
import com.gxa.ssm340.service.RewardService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * @author 叶骏
 * @description: TODO
 * @date 2023-10-23 10:32:58
 * @version: 1.0
 */
@Service
@Transactional(propagation = Propagation.REQUIRED)
public class RewardServiceImpl implements RewardService {
    @Autowired
    private RewardMapper rewardMapper;
    @Override
    public List<Reward> getAll() {
        final List<Reward> all = rewardMapper.getAll();
        return all;
    }

    @Override
    public Integer insert(Reward reward) {
        final Integer insert = rewardMapper.insert(reward);
        return insert;
    }

    @Override
    public Integer count() {
        final Integer count = rewardMapper.count();
        return count;
    }

    @Override
    public List<Reward> getByPage(PageDTO pageDTO) {
        final List<Reward> byPage = rewardMapper.getByPage(pageDTO);
        return byPage;
    }

    @Override
    public Integer delete(Integer id) {
        final Integer delete = rewardMapper.delete(id);
        return delete;
    }
}
